package Controller;

import Entity.Experiment;
import Entity.Selection;
import Service.ExperimentService;
import Service.SelectionService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;

public class DelExpServlet extends HttpServlet {  //ɾ��ԤԼ
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.setCharacterEncoding("utf-8");
        response.setCharacterEncoding("utf-8");
        HttpSession session = request.getSession(false);
        PrintWriter out =response.getWriter();
        if (session == null) {
            request.getRequestDispatcher("login.jsp").forward(request, response);
        }
        SelectionService ss = new SelectionService();
        String uid = (String) session.getAttribute("uid");
        int eid = Integer.parseInt(request.getParameter("eid"));
        ss.delSeletion(uid,eid);
        request.getRequestDispatcher("SelectServlet").forward(request, response);
    }
}
